#include <cstdio>
#include <algorithm>

using namespace std;

int *results;
void fun(int left, int right, int depth, int maxDepth)
{
    int i;
    if (!depth)
    {
        for (i = 0; i < maxDepth; i++)
        {
            printf("%3d", results[i]);
        }
        printf("\n");
        return;
    }
    for (i = left; i <= right - depth + 1; i++)
    {
        results[maxDepth - depth] = i;
        fun(i + 1, right, depth - 1, maxDepth);
    }
}

void fun(int n, int r)
{
    results = new int[r];
    fun(1, n, r, r);
}

int main(int argc, char const *argv[])
{
    int n, r;
    scanf("%d%d", &n, &r);
    fun(n, r);
    return 0;
}
